<%--
  Created by IntelliJ IDEA.
  User: z5727
  Date: 2022/9/29
  Time: 16:32
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<%@taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@taglib prefix="fn" uri="http://java.sun.com/jsp/jstl/functions" %>
<c:set value="${pageContext.request.contextPath}" var="path"></c:set>
<table class="table table-hover align-middle">
<thead>
<tr>
    <th class="pxp-is-checkbox" style="width: 1%;"><input type="checkbox" class="form-check-input select_all" ></th>
    <th colspan="2" style="width: 25%;">姓名</th>
    <th style="width: 20%;">应聘岗位</th>
    <th style="width: 15%;">应聘状态</th>
    <th>日期<span class="fa fa-angle-up ms-3"></span></th>
    <th>操作&nbsp;</th>
</tr>
</thead>
<tbody>
<c:forEach items="${requestScope.applyPositionPageInfo.list}" var="applyPosition">
<tr>
    <td><input type="checkbox" class="form-check-input select_one" data-id="${applyPosition.id}" data-name="${applyPosition.applyStatus}"></td>
    <td style="width: 3%;">
        <div class="pxp-company-dashboard-candidate-avatar pxp-cover candidates_face" data-id="${applyPosition.user.face}" style="background-image: url(/static/web/images/avatar-1.jpg);"></div>
    </td>
    <td>
        <a href="/web/companies/companiesCandidatesDetail/${applyPosition.userId}" target="_blank">
            <div class="pxp-company-dashboard-job-title user_position_id" data-id="${applyPosition.position.id}">${applyPosition.user.name}</div>
            <div class="pxp-company-dashboard-job-location"><span class="fa fa-globe me-1"></span>${applyPosition.user.nowIn}</div>
        </a>
    </td>
    <td><div class="pxp-company-dashboard-job-category">${applyPosition.position.positionName}</div></td>
    <c:if test="${applyPosition.applyStatus==0}">
    <td><div class="pxp-company-dashboard-job-status"><span class="badge rounded-pill bg-dark" data-id="0">待定</span></div></td>
    </c:if>
    <c:if test="${applyPosition.applyStatus==1}">
        <td><div class="pxp-company-dashboard-job-status"><span class="badge rounded-pill bg-dark" data-id="1">待定</span></div></td>
    </c:if>
    <c:if test="${applyPosition.applyStatus==2}">
        <td><div class="pxp-company-dashboard-job-status"><span class="badge rounded-pill bg-success" data-id="2">审核通过</span></div></td>
    </c:if>
    <c:if test="${applyPosition.applyStatus==3}">
        <td><div class="pxp-company-dashboard-job-status"><span class="badge rounded-pill bg-danger" data-id="3">已拒绝</span></div></td>
    </c:if>
    <td>
        <div class="pxp-company-dashboard-job-date"><fmt:formatDate value="${applyPosition.applicationTime}" pattern="yyyy-MM-dd hh:mm:ss"></fmt:formatDate></div>
    </td>
    <td>
        <div class="pxp-dashboard-table-options">
            <ul class="list-unstyled">
                <c:if test="${applyPosition.applyStatus==0}">
                    <li><button title="View profile" class="view_position" data-id="${applyPosition.user.id}"><span class="fa fa-eye"></span></button></li>
                    <li><button title="Send message"><span class="fa fa-envelope-o"></span></button></li>
                    <li><button title="Approve" class="a-check" data-id="${applyPosition.id}"><span class="fa fa-check"></span></button></li>
                    <li><button title="Reject" class="a-ban" data-id="${applyPosition.id}"><span class="fa fa-ban"></span></button></li>
                    <li><button title="Delete" class="a-del" data-id="${applyPosition.id}"><span class="fa fa-trash-o" ></span></button></li>
                </c:if>
                <c:if test="${applyPosition.applyStatus==1}">
                    <li><button title="View profile" class="view_position" data-id="${applyPosition.user.id}"><span class="fa fa-eye"></span></button></li>
                    <li><button title="Send message"><span class="fa fa-envelope-o"></span></button></li>
                    <li><button title="Approve" class="a-check" data-id="${applyPosition.id}"><span class="fa fa-check"></span></button></li>
                    <li><button title="Reject" class="a-ban" data-id="${applyPosition.id}"><span class="fa fa-ban"></span></button></li>
                    <li><button title="Delete" class="a-del" data-id="${applyPosition.id}"><span class="fa fa-trash-o" ></span></button></li>
                </c:if>
                <c:if test="${applyPosition.applyStatus==2}">
                    <li style="margin-right: 17px;"><button title="View profile" class="view_position" data-id="${applyPosition.user.id}"><span class="fa fa-eye"></span></button></li>
                    <li style="margin-right: 15px;"><button title="Send message"><span class="fa fa-envelope-o"></span></button></li>
<%--                    <li><button title="Approve" disabled="disabled"></button></li>--%>
<%--                    <li><button title="Reject" disabled="disabled"></button></li>--%>
                    <li style="margin-right: 17px;"><button title="Delete" class="a-del" data-id="${applyPosition.id}"><span class="fa fa-trash-o"></span></button></li>
                </c:if>
                <c:if test="${applyPosition.applyStatus==3}">
                    <li style="margin-right: 17px;"><button title="View profile" class="view_position" data-id="${applyPosition.user.id}"><span class="fa fa-eye"></span></button></li>
                    <li style="margin-right: 15px;"><button title="Send message"><span class="fa fa-envelope-o"></span></button></li>
                    <%--                    <li><button title="Approve" disabled="disabled"></button></li>--%>
                    <%--                    <li><button title="Reject" disabled="disabled"></button></li>--%>
                    <li style="margin-right: 17px;"><button title="Delete" class="a-del" data-id="${applyPosition.id}"><span class="fa fa-trash-o"></span></button></li>
                </c:if>
            </ul>
        </div>
    </td>
</tr>
</c:forEach>

</tbody>
</table>

<div class="row mt-4 mt-lg-5 justify-content-between align-items-center">
    <div class="col-auto" data-id="${requestScope.applyPositionPageInfo.total}">
        <nav class="mt-3 mt-sm-0" aria-label="Jobs list pagination">
            <ul class="pagination pxp-pagination">
                <c:forEach items="${requestScope.applyPositionPageInfo.navigatepageNums}" var="pageNum">
                    <c:if test="${requestScope.applyPositionPageInfo.pageNum eq pageNum}" var="isCur">
                        <li class="page-item active" aria-current="page">
                            <span class="page-link">${pageNum}</span>
                        </li>
                    </c:if>
                    <c:if test="${not isCur}">
                        <li class="page-item"><a class="page-link" href="javascript:void(0)">${pageNum}</a></li>
                    </c:if>
                </c:forEach>
            </ul>
        </nav>
    </div>
</div>
<script src="/static/web/js/jquery-3.4.1.min.js"></script>
<script type="text/javascript">
    $(function (){
        $(".candidates_face").each(function (){
            let face = $(this).data("id");
            $(this).css("background-image","url(/static/web/images/"+face+")");
        })
    })
</script>